package com.sms.controller;

import java.net.URLEncoder;

import com.system.comm.util.Config;
import com.system.comm.util.HttpUtil;


/**
 * 验证码通知短信接口
 * 
 * @ClassName: IndustrySMS
 * @Description: 验证码通知短信接口
 *
 */
public class IndustrySMS
{
	private static String operation = "/industrySMS/sendSMS";

	public static String accountSid = Config.ACCOUNT_SID;
	
 
	/**
	 * 验证码通知短信
	 * @return 
	 */
	public static boolean execute(String tel,String msg)
	{
		 String code =null;;
		String smsContent = "【美研科技】尊敬的用户，您的验证码为"+msg+"";
	    try{
	    	code = URLEncoder.encode(smsContent, "UTF-8");
	    }catch(Exception e){
	      
	    }
	    String url = Config.BASE_URL + operation;
	    String body = "accountSid=" + accountSid + "&to=" + tel + "&smsContent=" + code
	        + HttpUtil.createCommonParam();

	    // 提交请求
	    @SuppressWarnings("unused")
		String result = HttpUtil.post(url, body);
		return true;
	    
	}
   //创建验证码
	@SuppressWarnings("unused")
	private static String smsCode() {
		String random=(int)((Math.random()*9+1)*100000)+""; 
        return random;
	}
}
